package stu.day19_day24.day19;

import java.util.Scanner;

public class day19_1 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(",");

        int[] array = new int[str.length];
        for (int i=0;i<array.length;i++){
            array[i] = Integer.parseInt(str[i]);
        }

        int[] a1 = new int[str.length+1];
        int[] a2 = new int[str.length+1];

        int num = 0;
        for (int i=0;i<array.length;i++){
            num += array[i];
           a1[i+1] = num;
        }

        num = 0;
        for (int i=array.length-1;i>=0;i--){
            num += array[i];
            a2[i] = num;
        }

        for (int i=0;i<array.length;i++){
           if(a1[i]==a2[i+1]){
               System.out.println(i);
           }
        }

        System.out.println(-1);




    }


}
